﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.esriSystem;

namespace EAGL.Data
{
    public enum WorkspaceType
    {
        ACCESS, FILE_GDB, SHAPE_FILE, SDE
    }
    
    
    public class WorkspaceInfo
    {
        private string server;
        private string instance;
        private string database;
        private string version;
        private string userName;
        private string password;
        private WorkspaceType type;

        public WorkspaceInfo(WorkspaceType type)
        {
            this.type = type;
        }
        
        public WorkspaceType Type
        {
            get { return type; }
            set { this.type = value; }
        }
        
        public string Server
        {
            get { return server; }
            set { this.server = value; }
        }

        public string Instance
        {
            get { return instance; }
            set { this.instance = value; }
        }

        public string Database
        {
            get { return database; }
            set { this.database = value; }
        }

        public string Version
        {
            get { return version; }
            set { this.version = value; }
        }

        public string UserName
        {
            get { return userName; }
            set { this.userName = value; }
        }

        public string Password
        {
            get { return password; }
            set { this.password = value; }
        }

        public IPropertySet PropertySet
        {
            get
            {
                IPropertySet pset = new PropertySetClass();
                if (!string.IsNullOrEmpty(server))
                    pset.SetProperty("server", server);
                if (!string.IsNullOrEmpty(instance))
                    pset.SetProperty("instance", instance);
                if (!string.IsNullOrEmpty(database))
                    pset.SetProperty("database", database);
                if (!string.IsNullOrEmpty(version))
                    pset.SetProperty("version", version);
                if (!string.IsNullOrEmpty(userName))
                    pset.SetProperty("user", userName);
                if (!string.IsNullOrEmpty(password))
                    pset.SetProperty("password", password);
                return pset;
            }
        }


        
    }
}
